<?php
$arr = [7,1,2,3,4,5,1];
echo max($arr);

/**
 * https://leetcode-cn.com/leetbook/read/top-interview-questions-easy/x2zsx1/
 * 解题思路：
 * 贪心算法
 * @param $prices
 * @return int|mixed
 */
function maxProfit($prices) {
    $sum = 0;
    for($i = 1; $i < count($prices); $i++)
    {
        $sum += max(0, $prices[$i] - $prices[$i - 1]);
    }
    return $sum;
}